package br.com.toscano.gobra.business;

import javax.inject.Inject;

import br.com.toscano.gobra.domain.Perfil;
import br.com.toscano.gobra.persistence.PerfilDAO;
import br.gov.frameworkdemoiselle.lifecycle.Startup;
import br.gov.frameworkdemoiselle.stereotype.BusinessController;
import br.gov.frameworkdemoiselle.template.DelegateCrud;
import br.gov.frameworkdemoiselle.transaction.Transactional;

@BusinessController
public class PerfilBC extends DelegateCrud<Perfil, Long, PerfilDAO> {
	
	private static final long serialVersionUID = 1L;

	@Inject
	private UnidadeOrcamentariaBC unidadeOrcamentariaBC;
	
	@Inject
	private FuncionalidadeBC funcionaldiadeBC;

	@Startup
	@Transactional
	public void load() {
		if (findAll().isEmpty()) {
			insert(new Perfil("Administrador", unidadeOrcamentariaBC.findAll(),funcionaldiadeBC.findAll()));
		}
	}	

}
